package com.ug.common.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @Author LY
 * @create 2024/7/16 17:48
 * @Description 错误信息工具类
 */
public class ThrowsUtil {

    /**
     * 获取错误的堆栈信息
     */
    public static String getStackTrace(Throwable throwable){
        StringWriter sw = new StringWriter();
        try (PrintWriter pw = new PrintWriter(sw)) {
            throwable.printStackTrace(pw);
            return sw.toString();
        }
    }
}
